import { BasicColumn, FormSchema } from '@apps/antd-admin/src/components/Table';
import { RenderType } from '@pkg/setting';
import { airportList } from '@apps/ant-bus/src/views/business/airport/data/api';
import { employeeList } from '@apps/ant-bus/src/views/business/employeeManage/employee/data/api';

export const columns: BasicColumn[] = [
  {
    title: '订单号',
    dataIndex: 'orderNo',
    width: 180,
    isExport: false,
  },
  {
    title: '机场名称',
    dataIndex: 'airportName',
    width: 150,
  },
  {
    title: '销售名称',
    dataIndex: 'employeeName',
    width: 150,
  },
  {
    title: '销售手机号',
    dataIndex: 'employeePhone',
    width: 150,
  },
  {
    title: '服务名称',
    dataIndex: 'goodsName',
    width: 200,
  },
  {
    title: '评论人账号',
    dataIndex: 'mainAccount',
    width: 120,
    isExport: false,
  },
  {
    title: '评分',
    dataIndex: 'pfNum',
    width: 80,
  },
  {
    title: '评论状态',
    dataIndex: 'state',
    width: 120,
    dictData: [
      { label: '下架', value: 0 },
      { label: '上架', value: 1 },
    ],
    renderType: RenderType.DICT,
  },
  {
    title: '创建时间',
    dataIndex: 'createTime',
    width: 200,
  },
];

export const searchFormSchema: FormSchema[] = [
  {
    field: 'orderNo',
    label: '订单号',
    component: 'Input',
    colProps: { span: 4 },
  },
  {
    field: 'mainAccount',
    label: '会员账号',
    component: 'Input',
    colProps: { span: 4 },
  },
  {
    field: 'goodsName',
    label: '商品名称',
    component: 'Input',
    colProps: { span: 4 },
  },
  {
    field: 'airportId',
    label: '机场',
    component: 'ApiSelect',
    colProps: { span: 4 },
    componentProps: {
      api: airportList,
      labelField: 'airportName',
      valueField: 'airportId',
      immediate: true,
      showSearch: true,
    },
  },
  {
    field: 'serviceEmployeeId',
    label: '销售',
    component: 'ApiSelect',
    required: false,
    componentProps: {
      api: employeeList,
      params: { handlerName: 'busEmployeeListHandler' },
      labelField: 'employeeAccountName',
      valueField: 'employeeId',
      immediate: true,
      showSearch: true,
    },
  },
  {
    field: 'startDate',
    label: '开始日期',
    component: 'DatePicker',
    colProps: { span: 6 },
    componentProps: {
      valueFormat: 'YYYY-MM-DD',
      format: 'YYYY-MM-DD',
    },
  },
  {
    field: 'endDate',
    label: '结束日期',
    component: 'DatePicker',
    colProps: { span: 6 },
    componentProps: {
      valueFormat: 'YYYY-MM-DD',
      format: 'YYYY-MM-DD',
    },
  },
];
